package com.liuceng.zen.service;

import com.liuceng.zen.mapper.OperatingTrackMapper;
import com.liuceng.zen.pojo.domain.Member;
import com.liuceng.zen.pojo.domain.OperatingTrack;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by lijunhao on 16-11-1.
 */
@Service
public class OperatingTrackService extends BaseService<OperatingTrack>{
    //未处理状态
    private static final short state = 0;

    @Autowired
    OperatingTrackMapper operatingTrackMapper;

    /**
     * 添加操作轨迹
     * @param member
     * @param operationName
     * @param operationInstructions
     */
    @Transactional
    public void addOperatingTrack(Member member,String operationName,String operationInstructions,Integer frontAdGroupId,
    Integer frontMaterialId,Integer landingPageId,Integer frontCampaignId){
        OperatingTrack operatingTrack = new OperatingTrack();
        operatingTrack.setState(state);
        operatingTrack.setOperationName(operationName);
        operatingTrack.setOperationInstructions(operationInstructions);
        operatingTrack.setMemberId(member.getId());
        operatingTrack.setDepartmentId(member.getAdminDepartmentId());
        operatingTrack.setCreatedId(member.getId());
        operatingTrack.setUpdatedId(member.getId());
        operatingTrack.setFrontAdGroupId(frontAdGroupId);
        operatingTrack.setFrontMaterialId(frontMaterialId);
        operatingTrack.setLandingPageId(landingPageId);
        operatingTrack.setFrontCampaignId(frontCampaignId);
        super.insert(operatingTrack);
    }
}
